package com.gpframework.module.process.service.impl;

import com.gpframework.module.process.domain.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gpframework.module.process.mapper.GpProcessFormaldehydeContrastMapper;
import com.gpframework.module.process.domain.vo.GpProcessFormaldehydeContrastVo;
import com.gpframework.module.process.service.IGpProcessFormaldehydeContrastService;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import java.util.List;
/**
 * @ClassName GpProcessFormaldehydeContrast
 * @Author gpframework
 * @Date 2023-12-20
 * @Version 1.0.0
 * @Description 甲醛自测与送检机构数据对比加工Service业务层处理
 */
@Service
public class GpProcessFormaldehydeContrastServiceImpl extends ServiceImpl<GpProcessFormaldehydeContrastMapper, GpProcessFormaldehydeContrast> implements IGpProcessFormaldehydeContrastService {


    /**
     * @Description 查询列表返回VO 用于返回给前端的列表接口
     * @Author gpframework
     * @Date 2023-12-20
     * @Param [lqw]
     * @Return List<GpProcessFormaldehydeContrastVo>
     */
    @Override
    public List<GpProcessFormaldehydeContrastVo> listVo(QueryWrapper<GpProcessFormaldehydeContrast> lqw) {
        return this.baseMapper.listVo(lqw);
    }

    /**
     * @Description 通过查询详情VO 用于返回给前端的列详情接口
     * @Author gpframework
     * @Date 2023-12-20
     * @Param [id]
     * @Return GpProcessFormaldehydeContrastVo
     */
    @Override
    public GpProcessFormaldehydeContrastVo getVoById(Long id) {
        return this.baseMapper.getVo(id);
    }

    @Override
    public boolean copy(Long id, Integer copyNum) {
        GpProcessFormaldehydeContrast gpProcessFormaldehydeContrast = this.getById(id);
        if (gpProcessFormaldehydeContrast == null) {
            return false;
        }
        for (int i = 0; i < copyNum; i++) {
            gpProcessFormaldehydeContrast.setId(null);
            this.save(gpProcessFormaldehydeContrast);
        }
        return true;
    }
}
